<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js"></script>
	</head>
	<body>
		<div id="box">
			<input type="text" v-model="data"/>
			<button @click="handleClick()">添加</button>
			<ul>
				数据列表：
				<li v-for="(item,index) in dataList">
					第{{index+1}}个:{{item}}
					<button @click="handleDel(index)">删除</button>
				</li>
			</ul>
			<div v-html="html"></div>
		</div>
		<script>
			new Vue({
				el:"#box",
				data:{
					dataList:[],
					data:"",
					html:"<h3>使用了v-html</h3>"
				},
				methods:{
					handleClick(){
						this.dataList.push(this.data)
						this.data=""
					},
					handleDel(index){
						this.dataList.splice(index,1)
					}
				}
			})
		</script>
	</body>
</html>